package com.stox.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.stox.manager.CountryManager;
import com.stox.model.entity.CountryEntity;
import com.stox.repository.CountryRepository;

@Component
@Transactional
public class CountryManagerImpl implements CountryManager{

	@Autowired
	private CountryRepository countryRepository;

	@Override
	public long count() {
		return countryRepository.count();
	}
	
	@Override
	public List<CountryEntity> findAll() {
		return countryRepository.findAll();
	}
	
	@Override
	public CountryEntity findOne(String code) {
		return countryRepository.findOne(code);
	}

	@Override
	@Transactional
	public CountryEntity save(CountryEntity country) {
		return countryRepository.save(country);
	}
	
}
